using System;
using System.Windows.Forms;
using System.Drawing;

public class DGVFileColumn : DataGridViewColumn
{
    public DGVFileColumn()
        : base(new DGVFileCell())
    {
        this.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
    }

    public override DataGridViewCell CellTemplate
    {
        get
        {
            return base.CellTemplate;
        }
        set
        {
            // Ensure that the cell used for the template is a DGVFileCell.
            if (value != null &&
                !value.GetType().IsAssignableFrom(typeof(DGVFileCell)))
            {
                throw new InvalidCastException("Must be a DGVFileCell");
            }
            base.CellTemplate = value;
        }
    }
}
